package com.example.gzysmartcity.ui.adapter;

import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.gzysmartcity.R;
import com.example.gzysmartcity.repository.model.CityPark;

import org.jetbrains.annotations.NotNull;

public class ParkAdapter extends BaseQuickAdapter<CityPark.DataBean, BaseViewHolder> {
    private int p = 0;

    public ParkAdapter(int layoutResId) {
        super(layoutResId);
    }

    public void setP(int p) {
        this.p = p;
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, CityPark.DataBean cityPark) {
        TextView view = baseViewHolder.getView(R.id.rv_park_park);
        view.setText(cityPark.getCityParkName());
        if (baseViewHolder.getAdapterPosition() == p) {
            view.setBackgroundResource(R.drawable.tv_border_black);
        } else {
            view.setBackgroundResource(R.drawable.tv_borber_btn_style);
        }
    }
}
